home *** CD-ROM | disk | FTP | other *** search
/ PC User 2005 May / CD / PCU0505CD.iso / software / full / coffecup / files / html2005.exe / %MAINDIR% / Help / CoffeeCup HTML Editor 2005.chm / fhnonscroll.js < prev    next >
Encoding:
JavaScript  |  2005-02-16  |  2.7 KB  |  83 lines

  1. //⌐ DevHost Ltd, 2004 v1.4
  2. var type = "IE";
  3.  
  4. IdentifyBrowser();
  5. window.onload=resizeSplitWndw;
  6. window.onresize=resizeSplitWndw;
  7. window.onbeforeprint=set_to_print;
  8. window.onafterprint=reset_form;
  9. window.onerror = errorHandler;
  10.  
  11. function resizeSplitWndw()
  12. {
  13.   if (type=="MO") 
  14.   {
  15.     document.getElementById('FHScroll').style.top= document.getElementById('FHNonScroll').offsetHeight;
  16.   }
  17.   //-------------------------------------------------
  18.   if (type=="NN") 
  19.   { 
  20.     document.layers.FHScroll.style.top=document.layers.FHNonScroll.offsetHeight;
  21.   }
  22.   if (type=="OP") 
  23.   { 
  24.     document.all.FHScroll.style.top=document.all.FHNonScroll.offsetHeight;
  25.     document.all.FHNonScroll.style.width= document.body.offsetWidth;
  26.   }
  27.   //-------------------------------------------------
  28.   if (type=="IE") 
  29.   {
  30.     var oNonScroll=document.all.item("FHNonscroll");
  31.     var oScroll=document.all.item("FHScroll");
  32.     if (oScroll ==null) return;
  33.     if (oNonScroll != null)
  34.     document.all.FHScroll.style.overflow= "auto";
  35.     document.all.FHNonScroll.style.width= document.body.offsetWidth;
  36.     document.all.FHScroll.style.width= document.body.offsetWidth-4;
  37.     document.all.FHScroll.style.top= document.all.FHNonScroll.offsetHeight;
  38.     if (document.body.offsetHeight > document.all.FHNonScroll.offsetHeight)
  39.     document.all.FHScroll.style.height= document.body.offsetHeight - document.all.FHNonScroll.offsetHeight;
  40.     else 
  41.     document.all.FHScroll.style.height=0;
  42.   }
  43. }
  44.  
  45. function errorHandler() {
  46.   //alert("Error Handled"); 
  47.   //When printing pages that contain mixed elements of hidden paragraphs and links, printing will
  48.   //mistakenly raise an exception when parsing the elements, so we suppress it here.
  49.   return true;
  50. }
  51.  
  52. function set_to_print()
  53. {
  54.   var i;
  55.   document.all.FHScroll.style.overflow="visible";
  56.   document.all.FHScroll.style.width="100%";
  57.   if (window.FHScroll)document.all.FHScroll.style.height = "auto";
  58.   for (i=0; i < document.all.length; i++)
  59.   {
  60.     if (document.all[i].tagName == "BODY") 
  61.     {
  62.       document.all[i].scroll = "auto";
  63.     }
  64.     if (document.all[i].tagName == "A") 
  65.     {
  66.       document.all[i].outerHTML = "<a href=''>" + document.all[i].innerHTML + "</a>";
  67.     }
  68.   }
  69. }
  70.  
  71. function reset_form()
  72. {
  73.   document.location.reload();
  74. }
  75.  
  76. function IdentifyBrowser() 
  77. {
  78.   if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";//Opera
  79.   else if (document.all) type="IE";                                                        //Internet Explorer e.g. IE4 upwards
  80.   else if (document.layers) type="NN";                                                    //Netscape Communicator 4
  81.   else if (!document.all && document.getElementById) type="MO";                            //Mozila e.g. Netscape 6 upwards
  82.   else type = "IE";
  83. }